package org.spring.boot.fusion.sender;

import java.util.Date;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SenderController {

	@Autowired
	private AmqpTemplate amqpTemplate;

	@GetMapping("send")
	public ResponseEntity<Date> send() {
		amqpTemplate.convertAndSend("queue", new Date().getTime());
		return ResponseEntity.ok(new Date());
	}
	
	@GetMapping("send2")
	public ResponseEntity<Date> send2() {
		amqpTemplate.convertAndSend("zhaoyan",null, new Date().getTime());
		return ResponseEntity.ok(new Date());
	}
	
	@GetMapping("send3")
	public ResponseEntity<Date> send3() {
		amqpTemplate.convertAndSend("zhaoyan2","insert", new Date().getTime());
		return ResponseEntity.ok(new Date());
	}
	
	@GetMapping("send4")
	public ResponseEntity<Date> send4() {
		amqpTemplate.convertAndSend("zhaoyan2","updata", new Date().getTime());
		return ResponseEntity.ok(new Date());
	}
}
